CREATE TABLE [dbo].[TTAUXI_DIST]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TTAUXI_DI__NU_AN__038683F8] DEFAULT (datepart(year,getdate())),
[NU_MESE] [dbo].[TD_IN_002_MESE] NOT NULL,
[TI_AUXI_ORIG] [dbo].[TD_VC_001] NOT NULL,
[CO_AUXI_ORIG] [dbo].[TD_VC_020] NOT NULL,
[TI_AUXI_DEST] [dbo].[TD_VC_001] NOT NULL,
[CO_AUXI_DEST] [dbo].[TD_VC_020] NOT NULL,
[PO_DIST] [dbo].[TD_NU_009_004] NOT NULL CONSTRAINT [DF__TTAUXI_DI__PO_DI__0662F0A3] DEFAULT ((1.000)),
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTAUXI_DI__FE_US__084B3915] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTAUXI_DI__FE_US__093F5D4E] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTAUXI_DIST] ADD CONSTRAINT [CK__TTAUXI_DI__NU_AN__047AA831] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TTAUXI_DIST] ADD CONSTRAINT [CK__TTAUXI_DI__NU_ME__056ECC6A] CHECK (([NU_MESE]>=(0) AND [NU_MESE]<=(13)))
GO
ALTER TABLE [dbo].[TTAUXI_DIST] ADD CONSTRAINT [CK__TTAUXI_DI__PO_DI__075714DC] CHECK (([PO_DIST]>=(0)))
GO
ALTER TABLE [dbo].[TTAUXI_DIST] ADD CONSTRAINT [XPKTTAUXI_DIST] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [NU_MESE], [TI_AUXI_ORIG], [CO_AUXI_ORIG], [TI_AUXI_DEST], [CO_AUXI_DEST]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTAUXI_DIST] ADD CONSTRAINT [FK1_TMPARA_CONT_A_TTAUXI_DIST] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_CONT] ([CO_EMPR])
GO
